<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/admin/common::common_head">
    <title></title>
</head>
<body>
<div class="container-fluid">
    <div class="row cm-fix-height">
        <div class="col-sm-12">
            <div class="panel panel-default">
                <div class="panel-body" id="data-list-box">
                    <table class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>标题</th>
                            <th>发送者</th>
                            <th>发送时间</th>
                            <th>是否已读</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr style="cursor: pointer" th:each="inform : ${informList}" th:onclick="|showDetail(this, ${inform.informId})|">
                            <td th:text="${inform.informId}"></td>
                            <td th:text="${inform.informTitle}"></td>
                            <td th:text="${inform.informSenderName}"></td>
                            <td th:text="${dateMap.get(inform.informId)}"></td>
                            <td th:text="${inform.readed} ? '已读' : '未读'"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/admin/assets/js/lib/jquery.min.js}"></script>
<script th:src="@{/admin/assets/layer/layer.js}"></script>
<script type="text/javascript">
    document.title = '通知列表 - 亿人宝贷款平台';

    function showDetail(_this, id) {
        let loadIndex = layer.load(0, {
            offset: ['50%', '50%']
        });
        $.getJSON('[[@{/admin/inform/readInformDetail}]]', {
            informId: id
        }, function (data) {
            layer.close(loadIndex);
            _this.cells[4].innerText = '已读';
            layer.open({
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['420px', '240px'], //宽高
                title: data.obj.informTitle,
                content: '<p style="padding: 10px;">' + data.obj.informContent + '</p>'
            });
        });
    }
</script>
</body>
</html>